Compose

Given two functions f and g we would like to be able to <#106#>compose<#106#> them to produce a function that first applies g then applies f. Normally, this is written as fog, but unfortunately TEX doesn't have infix functions, so we'll have to write it #math91#Compose~f~g.

#math92#
Compose~f~g~x = f~(g~x)  

;SPMgt;From this definition, we can deduce that Compose is associative:
#math93#
Compose~(Compose~f~g)~h;SPMnbsp;;SPMnbsp;;SPMnbsp;;SPMnbsp;
  = Compose~f~(Compose~g~h)  

and Identity is the left unit of Compose:
#math94#
Compose~Identity~f = f  

The reader may wonder why Identity is called a <#114#>left<#114#> unit even though it occurs on the right of the Compose --- this is a side-effect of using prefix notations where infix is more normal. The infix version of this equation is:
#math95#
Identityof = f  

so Identity is indeed on the left of the composition.

Compose can be implemented in TEX as